package com.lee.lease.web.app.controller.Login;

import com.lee.lease.common.result.Result;
import com.lee.lease.web.app.service.SmsService;
import com.lee.lease.web.app.vo.login.LoginVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * ClassName: LoginController
 * Package: com.lee.lease.web.app.controller
 * Description:
 */
@Tag(name="登录管理")
@RestController("LoginController2")
@RequestMapping("/app/login")
public class LoginController {

    @Autowired
    private SmsService smsService;
    @Operation(summary = "获取短信验证码")
    @GetMapping("/getCode")
    public Result getCode(String phone){
        smsService.getCode(phone);
        return Result.ok();
    }

    @Operation(summary = "登录")
    @PostMapping
    public Result login (@RequestBody LoginVo loginVo){
        String token = smsService.login(loginVo);
        return Result.ok(token);
    }
}
